package edu_pxxy.xwy.daohelper;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class MyDBOpenHelper extends SQLiteOpenHelper {

    private static final String TAG = "MyDBOpenHelper";
    private static final String DB_NAME = "xwy.db";
    private static final int DB_VERSION = 1;

    public MyDBOpenHelper(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        Log.d(TAG, "没有数据库创建数据库......");
        String sql = "create table food(_id integer primary key autoincrement , foodname text ,foodprice real , count integer )";
        sqLiteDatabase.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
        Log.d(TAG, "数据库更新了");
    }

}
